function hideDiv(div_id){
            $("#" + div_id).animate({opacity: "hide" }, 300);
}
function popupDiv(div_id) {
            var div_obj = $("#" + div_id);
            //窗口宽度,高度
            var winWidth = $(window).width();
            var winHeight = $(window).height();
            //弹出的div的宽度,高度
            var popHeight = div_obj.height();
            var popWidth = div_obj.width();
            div_obj.animate({
				 opacity: "show", left: (winWidth-popWidth) / 2, top: (winHeight-popHeight)/2-400,width:popWidth,height:popHeight}, 300);          
}
$(function() {
            $("#add_div").easydrag();
            $("#add_div").setHandler("#add_div #add_head");
});
$(function() {
    $("#poppicture_div").easydrag();
    $("#poppicture_div").setHandler("#poppicture_div #poppicture_head");
});


function hideaddDiv()
{
	hideDiv('add_div'); 
}
function clickEditEmp(id)
{
	 popupDiv('add_div'); 
	 lgqEmpManager.getById(id,function(data)
			 {
		 		alert(data.id);
		 		$("#empid").val(data.id);
		 		$("#empno").html(data.empno);
		 		$("#emp_name").val(data.name)
		 		$("#sex_edit").val(data.sex);
		 		$("#educationtype").val(data.education.id);
		 		$("#eduDegreetype").val(data.eduDegree.id);
		 		$("#depttype").val(data.duty.id);
		 		$("#dutytype").val(data.duty.id);
		 		$("#skilltype").val(data.skillGrade.id);
		 		$("#salary_edit").val(data.salary);
		 		$("#empstatustype").html(data.empStatus.name);
		 		$("#address_edit").val(data.address);
		 		$("#phone_edit").val(data.phone);
		 		$("#cid").val(data.idCardid);
			 });
}
$(function()
		{
   
    	
    	EducationManager.getAll(callBack_edu);
    	EduDegreeManager.getAll(callBack_degree);
    	DutyManager.getAllDuty(callBack_duty);
    	DeptDAOImpl.getALLDept(callBack_dept);
    	SkillGradeManager.getAll(callBack_skill);
		});

function callBack_edu(data){
	
	var obj=document.getElementById("educationtype");
	DWRUtil.removeAllOptions(obj);
	DWRUtil.addOptions(obj,data,"id","name");
	var obj=document.getElementById("edu");
	DWRUtil.removeAllOptions(obj);
	DWRUtil.addOptions(obj,data,"id","name");
}
function callBack_degree(data){
	var obj=document.getElementById("eduDegreetype");
	DWRUtil.removeAllOptions(obj);
	DWRUtil.addOptions(obj,data,"id","name");
}
function callBack_duty(data){
	var obj=document.getElementById("dutytype");
	DWRUtil.removeAllOptions(obj);
	DWRUtil.addOptions(obj,data,"id","name");
}
function callBack_dept(data){
	var obj2=document.getElementById("depttype");

	DWRUtil.removeAllOptions(obj2);
	DWRUtil.addOptions(obj2,data,"id","name");
	
}
function callBack_skill(data){
	var obj2=document.getElementById("skilltype");

	DWRUtil.removeAllOptions(obj2);
	DWRUtil.addOptions(obj2,data,"id","name");
	
	var obj2=document.getElementById("skill");

	DWRUtil.removeAllOptions(obj2);
	DWRUtil.addOptions(obj2,data,"id","name");
	
}
function popphoto(id)
{
	document.getElementById("picture").src="photo/"+id+".jpg";
	//$("#picture").src("${ctx}/photo/"+id+".jpg");
	popupDiv('poppicture_div'); 
}
function hideapictureDiv()
{
	hideDiv('poppicture_div');
	
}
function popidcard(id)
{
	document.getElementById("picture").src="photo/"+id+".jpg";
	popupDiv('poppicture_div'); 
}
function popedu(img)
{
	document.getElementById("picture").src="photo/"+img;
	popupDiv('poppicture_div'); 
}

function search2()
{
	$("#searchform").submit();
}

function changePageSize()
{
	var pageSize=$("#pageSize").val();
	location.href="GetAllEmp?pageSize="+pageSize;
}